//
//  JGTitleMenuViewController.m
//  CustomTabBar
//
//  Created by JJetGu on 15/7/2.
//  Copyright (c) 2015年 JJetGu. All rights reserved.
//

#import "JGTitleMenuViewController.h"

@interface JGTitleMenuViewController ()

@property (nonatomic, strong)NSArray *titles;
@end

@implementation JGTitleMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

-(NSArray *)titles
{
    if (!_titles) {
        self.titles = @[@"首页",@"好友圈",@"群微博",@"我的微博"];
    }
    
    return _titles;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
        cell.textLabel.textColor = [UIColor whiteColor];
        cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
        
        cell.backgroundColor = [UIColor clearColor];
    }
    
    if (indexPath.row == 0) {
        cell.textLabel.textColor = [UIColor orangeColor];
    }
    cell.textLabel.text = self.titles[indexPath.row];
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (self.selectedTitleBlock) {
        self.selectedTitleBlock(self.titles[indexPath.row]);
    }
    
    
}

@end
